# -*- coding: utf-8 -*-

import __main__
from appengine_utilities import sessions
from appengine_utilities import flash
from appengine_utilities import event
from appengine_utilities import cache
from appengine_utilities.rotmodel import ROTModel

import wsgiref.handlers
import xmw
from xmw.db import ds
from google.appengine.ext import webapp
from google.appengine.ext import db
import urllib

import logging
from xmw.db import user_mgr
from google.appengine.api import mail

class Data(db.Model):
    data=db.IntegerProperty()
class Data2(Data):
    def init(self):
        self.t="12e44"
class URL(db.Model):
    u=db.URLProperty(required = True)
        
class MainPage(xmw.RequestHandler):
    def get(self):
        (u,e)=self.get_key_from_GET("u")
        is_url=True
        try:
            url=URL(u=u)
        except:
            is_url=False
        print is_url
        return
    
            
        #url.put()
        self.render_template(None, '../html/test.html')
        """
        mail.send_mail('ximenwai admin<ximenwai.liu@gmail.com>',

        'buckler.liu@gmail.com',

        'test',

        'rt',

        )
        """
        return 
        

        
    
    
        
def main():
  application = webapp.WSGIApplication(
                                       [('/test', MainPage)],
                                       debug=True)
  wsgiref.handlers.CGIHandler().run(application)

if __name__ == "__main__":
  main()